/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package knn.iris;

import knn.IMetric;

/**
 *
 * @author Nguyen Thuy Ngoc <ntngoc1988@gmail.com>
 */
public class Manhattan4Iris implements IMetric<IrisSample> {

    @Override
    public double calcDistance(IrisSample sample1, IrisSample sample2) {
        double distance = 0;
        distance += Math.abs(sample1.getSepalLength() - sample2.getSepalLength());
        distance += Math.abs(sample1.getSepalWidth() - sample2.getSepalWidth());
        distance += Math.abs(sample1.getPetalLength() - sample2.getPetalLength());
        distance += Math.abs(sample1.getPetalWidth() - sample2.getPetalWidth());

        return distance;
    }
}
